using System;
using System.Collections.Generic;
using UnityEngine;

public class UIController : MonoBehaviour
{
	public static UIController instance;

	public UIweaponCDcon weaponUIcon;

	public UIEventListener accflagBtn;

	public UIEventListener decflagBtn;

	public UIAnchor speedanchor;

	public UIWidget speedwi;

	public UIWidget joystickwi;

	public UIEventListener machinegunbtn;

	public UIEventListener missilebtn;

	public UIEventListener singlemissilebtn;

	public UIEventListener youdaodanbtn;

	public UIEventListener pausebtn;

	public UIEventListener setbtn;

	public UISprite playerAimFlag;

	public UISprite aiAimFlag;

	private bool ishaveAim;

	private bool missilehaveAim;

	public GameObject timeobj;

	public UILabel timelabel;

	public bool ishavesingle;

	public bool ishavemultiple;

	public List<UISprite> dirflags;

	public List<UISprite> frameflags;

	public List<UISprite> frameflags_red;

	public List<UIPlayTween> frameflagsAnima;

	public UISprite frameflag_yellow;

	public UIPlayTween yellow_frameAnima;

	public List<UISprite> hplist;

	public List<UILabel> aiplanenames;

	public List<UILabel> friplanenames;

	public UISprite missile_red_flag;

	public UISprite missile_yellow_flag;

	public UIWidget youdaodan_flag;

	public List<UISprite> fri_hplist;

	public List<UISprite> fri_dirflags;

	public UISlider player_hp;

	public UISprite playerhp_for;

	public UILabel speedlabel;

	public UISprite heightsp;

	public TweenAlpha heightanima;

	public UILabel heightlabel;

	public TickMove speedtick;

	public TickMove heighttick;

	public UILabel hitinfo_label;

	public TweenAlpha hitinfo_anim;

	public UILabel hitinfo_label_down;

	public UIWidget missilelockwi;

	public UILabel fight_info;

	public List<UIhole> holes;

	public UIshake shakeui;

	public UISprite Desdirflag;

	public UIWidget Desflag;

	private Vector3 disappearPos = new Vector3(-1000f, -1000f, 0f);

	public Transform dirflag_parent;

	public Transform dirflagfri_parent;

	public Transform hp_parent;

	public Transform hpfri_parent;

	public Transform lockframe_parent;

	public Transform ai_name_parent;

	public Transform holeparent;

	private int fightlinenum;

	private float showfightinfo_time;

	private bool have_fightinfo;

	private List<string> str_list = new List<string>();

	private bool curai_isplane;

	private float aimcheck_dis;

	private bool showheightwarning;

	private bool iswarning;

	private bool playanima_yes;

	private Color yellowcolor = new Color(1f, 66f / 85f, 0f);

	public int holesnum;

	private int width_screen;

	private float scalerate;

	private void Awake()
	{
		if (instance == null)
		{
			instance = this;
		}
	}

	public void init_list()
	{
		dirflags.Clear();
		frameflags.Clear();
		frameflags_red.Clear();
		frameflagsAnima.Clear();
		hplist.Clear();
		fri_hplist.Clear();
		fri_dirflags.Clear();
		aiplanenames.Clear();
		friplanenames.Clear();
		holes.Clear();
		foreach (Transform item in dirflag_parent)
		{
			dirflags.Add(item.GetComponent<UISprite>());
		}
		foreach (Transform item2 in lockframe_parent)
		{
			if (item2.name.Equals("bodyframe"))
			{
				frameflags.Add(item2.GetComponent<UISprite>());
				foreach (Transform item3 in item2)
				{
					frameflags_red.Add(item3.GetComponent<UISprite>());
					frameflagsAnima.Add(item3.GetComponent<UIPlayTween>());
				}
			}
		}
		foreach (Transform item4 in hp_parent)
		{
			hplist.Add(item4.GetComponent<UISprite>());
		}
		foreach (Transform item5 in hpfri_parent)
		{
			fri_hplist.Add(item5.GetComponent<UISprite>());
		}
		foreach (Transform item6 in dirflagfri_parent)
		{
			fri_dirflags.Add(item6.GetComponent<UISprite>());
		}
		foreach (Transform item7 in ai_name_parent)
		{
			switch (item7.name)
			{
				case "name":
					aiplanenames.Add(item7.GetComponent<UILabel>());
					break;
				case "name_fri":
					friplanenames.Add(item7.GetComponent<UILabel>());
					break;
			}
		}
		foreach (Transform item8 in holeparent)
		{
			holes.Add(item8.GetComponent<UIhole>());
		}
	}

	private void Start()
	{
		UIEventListener uIEventListener = accflagBtn;
		uIEventListener.onPress = (UIEventListener.BoolDelegate)Delegate.Combine(uIEventListener.onPress, new UIEventListener.BoolDelegate(pressacc));
		UIEventListener uIEventListener2 = decflagBtn;
		uIEventListener2.onPress = (UIEventListener.BoolDelegate)Delegate.Combine(uIEventListener2.onPress, new UIEventListener.BoolDelegate(pressdec));
		UIEventListener uIEventListener3 = machinegunbtn;
		uIEventListener3.onPress = (UIEventListener.BoolDelegate)Delegate.Combine(uIEventListener3.onPress, new UIEventListener.BoolDelegate(machineBtn));
		UIEventListener uIEventListener4 = missilebtn;
		uIEventListener4.onPress = (UIEventListener.BoolDelegate)Delegate.Combine(uIEventListener4.onPress, new UIEventListener.BoolDelegate(missileBtn));
		UIEventListener uIEventListener5 = singlemissilebtn;
		uIEventListener5.onPress = (UIEventListener.BoolDelegate)Delegate.Combine(uIEventListener5.onPress, new UIEventListener.BoolDelegate(singleMissileBtn));
		UIEventListener uIEventListener6 = youdaodanbtn;
		uIEventListener6.onPress = (UIEventListener.BoolDelegate)Delegate.Combine(uIEventListener6.onPress, new UIEventListener.BoolDelegate(youdaodanBtn));
		UIEventListener uIEventListener7 = pausebtn;
		uIEventListener7.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(uIEventListener7.onClick, new UIEventListener.VoidDelegate(pausegame));
		UIEventListener uIEventListener8 = setbtn;
		uIEventListener8.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(uIEventListener8.onClick, new UIEventListener.VoidDelegate(settingBtn));
		setcontrollUI();
	}

	public void setcontrollUI()
	{
		if (GlobalInf.PlaneCtrlType == PLANECTRLTYPE.BUTTON)
		{
			joystickwi.alpha = 0.3f;
			speedanchor.relativeOffset = new Vector2(0.2f, -0.35f);
			speedanchor.enabled = true;
		}
		else
		{
			joystickwi.alpha = 0f; joystickwi.gameObject.SetActive(false);
			speedanchor.relativeOffset = new Vector2(-0.35f, -0.35f);
			speedanchor.enabled = true;
		}
	}

	private void Update()
	{
		if (ishaveAim)
		{
			bulletfocusAIM();
		}
		if (have_fightinfo)
		{
			showfightinfo_time += Time.deltaTime;
			if (showfightinfo_time > 10f)
			{
				fight_info.text = null;
				fightlinenum = 0;
				str_list.Clear();
				have_fightinfo = false;
			}
		}
	}

	public void show_fight_info(string str)
	{
		if (fightlinenum >= 3)
		{
			str_list.RemoveAt(0);
		}
		str_list.Add(str);
		fight_info.text = str_list[0];
		for (int i = 1; i < str_list.Count; i++)
		{
			fight_info.text = fight_info.text + "\n" + str_list[i];
		}
		have_fightinfo = true;
		fightlinenum++;
		showfightinfo_time = 0f;
	}

	public void pausegame(GameObject btn)
	{
		if (!AdManager1.instance.ShieldAddress)
		{
			AdManager.single.ShowNative(0);
		}
		if (btn != null)
		{
			MonoInstance<AudioController>.instance.play(AudioType.UI_BTN, 0f);
		}
		Time.timeScale = 0f;
		if (GlobalInf.gamemode == TASKMODE.level)
		{
			GameUIController.instance.enable_pauseui_level();
			return;
		}
		switch (GlobalInf.chanllengeid)
		{
			case 6:
				GameUIController.instance.enable_pause_sur();
				break;
			case 7:
				GameUIController.instance.enable_pause_tdm();
				break;
			case 8:
				GameUIController.instance.enable_pause_dtb();
				break;
			case 9:
				GameUIController.instance.enable_pause_ffa();
				break;
		}
	}

	public void settingBtn(GameObject btn)
	{
		Time.timeScale = 0f;
		MonoInstance<AudioController>.instance.play(AudioType.UI_BTN, 0f);
		GameUIController.instance.enable_optionui();
	}

	public void youdaodanBtn(GameObject btn, bool ispress)
	{
		if (youdaodan_flag.alpha == 1f && weaponUIcon.cur_youdaodan > 0 && ispress)
		{
			plane_smothfollow.instance.youdaodanfire();
			planeisaim(istrue: false);
		}
	}

	public void planeisaim(bool istrue)
	{
		if (istrue)
		{
			missilelock_appear();
			MonoInstance<AudioController>.instance.play(AudioType.warning, 0f);
			if (weaponUIcon.cur_youdaodan == 0)
			{
				if (youdaodan_flag.alpha != 0.3f)
				{
					youdaodan_flag.alpha = 0.3f;
				}
			}
			else if (youdaodan_flag.alpha != 1f)
			{
				youdaodan_flag.alpha = 1f; youdaodan_flag.gameObject.SetActive(true);
			}
		}
		else
		{
			missilelock_disappear();
			if (youdaodan_flag.alpha != 0.3f)
			{
				youdaodan_flag.alpha = 0.3f;
			}
			MonoInstance<AudioController>.instance.stop(AudioType.warning);
		}
	}

	public void machineBtn(GameObject btn, bool ispress)
	{
		weaponUIcon.recgun = ispress;
		weaponUIcon.regunflag = ispress;
		if (weaponUIcon.cur_gun > 0)
		{
			plane_smothfollow.instance.machinegunFlag = ispress;
		}
		else
		{
			plane_smothfollow.instance.machinegunFlag = false;
		}
	}

	public void missileBtn(GameObject btn, bool ispress)
	{
		weaponUIcon.recmissile = ispress;
		weaponUIcon.remissileflag = ispress;
		if (weaponUIcon.cur_missile > 0)
		{
			plane_smothfollow.instance.guidedmissileFlag = ispress;
		}
		else
		{
			plane_smothfollow.instance.guidedmissileFlag = false;
		}
	}

	public void singleMissileBtn(GameObject btn, bool ispress)
	{
		weaponUIcon.recsinglemissile = ispress;
		weaponUIcon.recsinglemissileflag = ispress;
		if (weaponUIcon.cur_singlemissile > 0)
		{
			plane_smothfollow.instance.singlemissileFlag = ispress;
		}
		else
		{
			plane_smothfollow.instance.singlemissileFlag = false;
		}
	}

	public void pressacc(GameObject btn, bool ispress)
	{
		PlaneMoveController.instance.accflagstate = ispress;
		plane_smothfollow.instance.accflag = ispress;
		if (ispress)
		{
			speedwi.alpha = 1f; speedwi.gameObject.SetActive(true);
		}
		else
		{
			speedwi.alpha = 0.3f;
		}
	}

	public void pressdec(GameObject btn, bool ispress)
	{
		PlaneMoveController.instance.decflagstate = ispress;
		plane_smothfollow.instance.decflag = ispress;
		if (ispress)
		{
			speedwi.alpha = 1f; speedwi.gameObject.SetActive(true);
		}
		else
		{
			speedwi.alpha = 0.3f;
		}
	}

	public void SetPlayerAim(Vector3 aimpos, bool istrue)
	{
		NGUITools.SetActive(playerAimFlag.gameObject, istrue);
		if (istrue)
		{
			playerAimFlag.transform.localPosition = new Vector3((aimpos.x - (float)(Screen.width / 2)) / GlobalInf.ratioReltoUI, (aimpos.y - (float)(Screen.height / 2)) / GlobalInf.ratioReltoUI, 0f);
		}
		else
		{
			playerAimFlag.transform.localPosition = disappearPos;
		}
	}

	public void appearPlayeraim()
	{
		playerAimFlag.enabled = true;
	}

	public void disPlayeraim()
	{
		playerAimFlag.enabled = false;
	}

	public void setAIaim(Vector3 aiaimpos, bool istrue, AI_TYPE typeai = AI_TYPE.aiplane)
	{
		ishaveAim = istrue;
		if (typeai != 0)
		{
			curai_isplane = false;
			NGUITools.SetActive(aiAimFlag.gameObject, state: false);
		}
		else
		{
			curai_isplane = istrue;
			NGUITools.SetActive(aiAimFlag.gameObject, istrue);
		}
		if (!istrue)
		{
			aiAimFlag.transform.localPosition = disappearPos;
		}
		else
		{
			aiAimFlag.transform.localPosition = new Vector3((aiaimpos.x - (float)(Screen.width / 2)) / GlobalInf.ratioReltoUI, (aiaimpos.y - (float)(Screen.height / 2)) / GlobalInf.ratioReltoUI, 0f);
		}
		if (playerAimFlag.color != Color.green)
		{
			playerAimFlag.color = Color.green;
			plane_smothfollow.instance.curAI = null;
		}
	}

	public void bulletfocusAIM()
	{
		if (curai_isplane)
		{
			aimcheck_dis = 45f;
		}
		else
		{
			aimcheck_dis = 30f;
		}
		if (Vector3.Distance(playerAimFlag.transform.localPosition, aiAimFlag.transform.localPosition) < aimcheck_dis)
		{
			if (playerAimFlag.color != Color.red)
			{
				playerAimFlag.color = Color.red;
				plane_smothfollow.instance.curAI = AIPool.instance.curaimAI;
			}
		}
		else if (playerAimFlag.color != Color.green)
		{
			playerAimFlag.color = Color.green;
			plane_smothfollow.instance.curAI = null;
		}
	}

	public void ai_nameshow(Vector3 namepos, int num, bool istrue)
	{
		if (UnityVersionUtil.IsActive(aiplanenames[num].gameObject) != istrue)
		{
			NGUITools.SetActive(aiplanenames[num].gameObject, istrue);
		}
		if (namepos != Vector3.zero)
		{
			if (aiplanenames[num].text.Equals(string.Empty))
			{
				aiplanenames[num].text = GlobalInf.ai_names[num];
			}
			aiplanenames[num].transform.localPosition = new Vector3((namepos.x - (float)(Screen.width / 2)) / GlobalInf.ratioReltoUI, (namepos.y + 35f * GlobalInf.ratioReltoUI - (float)(Screen.height / 2)) / GlobalInf.ratioReltoUI, 0f);
		}
		else
		{
			aiplanenames[num].transform.localPosition = disappearPos;
		}
	}

	public void fri_nameshow(Vector3 namepos, int num, bool istrue)
	{
		if (UnityVersionUtil.IsActive(friplanenames[num].gameObject) != istrue)
		{
			NGUITools.SetActive(friplanenames[num].gameObject, istrue);
		}
		if (namepos != Vector3.zero)
		{
			if (friplanenames[num].text.Equals(string.Empty))
			{
				friplanenames[num].text = GlobalInf.fri_names[num];
			}
			friplanenames[num].transform.localPosition = new Vector3((namepos.x - (float)(Screen.width / 2)) / GlobalInf.ratioReltoUI, (namepos.y + 35f * GlobalInf.ratioReltoUI - (float)(Screen.height / 2)) / GlobalInf.ratioReltoUI, 0f);
		}
		else
		{
			friplanenames[num].transform.localPosition = disappearPos;
		}
	}

	public void fri_showHP(Vector3 hppos, int num, bool istrue)
	{
		NGUITools.SetActive(fri_hplist[num].gameObject, istrue);
		if (hppos != Vector3.zero)
		{
			fri_hplist[num].transform.localPosition = new Vector3((hppos.x - (float)(Screen.width / 2)) / GlobalInf.ratioReltoUI, (hppos.y + 22f * GlobalInf.ratioReltoUI - (float)(Screen.height / 2)) / GlobalInf.ratioReltoUI, 0f);
		}
		else
		{
			fri_hplist[num].transform.localPosition = disappearPos;
		}
	}

	public void fri_changeHP(int num, int curhp, int maxhp)
	{
		fri_hplist[num].fillAmount = (float)curhp / (float)maxhp;
	}

	public void Des_flagshow(Vector3 despos, bool istrue, float scalerate = 0.6f)
	{
		NGUITools.SetActive(Desflag.gameObject, istrue);
		if (despos != Vector3.zero)
		{
			Desflag.transform.localPosition = new Vector3((despos.x - (float)(Screen.width / 2)) / GlobalInf.ratioReltoUI, (despos.y - (float)(Screen.height / 2)) / GlobalInf.ratioReltoUI, 0f);
			Desflag.transform.localScale = new Vector3(scalerate, scalerate, scalerate);
		}
		else
		{
			Desflag.transform.localPosition = disappearPos;
		}
	}

	public void Des_dirshow(Vector3 despos, bool istrue, float scalerate = 0.6f)
	{
		NGUITools.SetActive(Desdirflag.gameObject, istrue);
		if (despos != Vector3.zero)
		{
			Desdirflag.transform.localPosition = new Vector3((despos.x - (float)(Screen.width / 2)) / GlobalInf.ratioReltoUI, (despos.y - (float)(Screen.height / 2)) / GlobalInf.ratioReltoUI, 0f);
			Desdirflag.transform.up = Desdirflag.transform.localPosition;
			Desdirflag.transform.localScale = new Vector3(scalerate, scalerate, scalerate);
		}
		else
		{
			Desdirflag.transform.localPosition = disappearPos;
		}
	}

	public void fri_dirshow(Vector3 dirpos, int num, bool istrue, float scalerate = 0.6f, AI_TYPE typeai = AI_TYPE.aiplane)
	{
		NGUITools.SetActive(fri_dirflags[num].gameObject, istrue);
		if (dirpos != Vector3.zero)
		{
			if (typeai == AI_TYPE.aiplane)
			{
				if (fri_dirflags[num].spriteName != "DT_A_jiantou_01")
				{
					fri_dirflags[num].spriteName = "DT_A_jiantou_01";
				}
			}
			else if (fri_dirflags[num].spriteName != "DT_A_jiantou_02")
			{
				fri_dirflags[num].spriteName = "DT_A_jiantou_02";
			}
			fri_dirflags[num].transform.localPosition = new Vector3((dirpos.x - (float)(Screen.width / 2)) / GlobalInf.ratioReltoUI, (dirpos.y - (float)(Screen.height / 2)) / GlobalInf.ratioReltoUI, 0f);
			fri_dirflags[num].transform.up = fri_dirflags[num].transform.localPosition;
			fri_dirflags[num].transform.localScale = new Vector3(scalerate, scalerate, scalerate);
		}
		else
		{
			fri_dirflags[num].transform.localPosition = disappearPos;
		}
	}

	public void ai_showHP(Vector3 hppos, int num, bool istrue)
	{
		NGUITools.SetActive(hplist[num].gameObject, istrue);
		if (hppos != Vector3.zero)
		{
			hplist[num].transform.localPosition = new Vector3((hppos.x - (float)(Screen.width / 2)) / GlobalInf.ratioReltoUI, (hppos.y + 22f * GlobalInf.ratioReltoUI - (float)(Screen.height / 2)) / GlobalInf.ratioReltoUI, 0f);
		}
		else
		{
			hplist[num].transform.localPosition = disappearPos;
		}
	}

	public void changeHP(int num, int curhp, int maxhp)
	{
		hplist[num].fillAmount = (float)curhp / (float)maxhp;
	}

	public void change_playerHP(int curhp, int maxhp, bool is_bullet)
	{
		player_hp.value = (float)curhp / (float)maxhp;
		if (player_hp.value < 0.006f)
		{
			if (player_hp.value > 0f)
			{
				player_hp.value = 0.006f;
			}
			else
			{
				if (playerhp_for.enabled)
				{
					playerhp_for.enabled = false;
				}
				player_hp.value = 0f;
			}
		}
		else if (!playerhp_for.enabled)
		{
			playerhp_for.enabled = true;
		}
		shakeui.showshake();
		if (is_bullet)
		{
			show_holes();
		}
	}

	public void showspeedandheight(int speed, int height)
	{
		speedlabel.text = speed + "kph";
		speedtick.scrollmove(speed);
		if (showheightwarning)
		{
			if (height < 200)
			{
				height_warning();
			}
			else
			{
				height_normal();
			}
		}
		else
		{
			if (height > 200)
			{
				showheightwarning = true;
			}
			height_normal();
		}
		height *= 2;
		if (height < 0)
		{
			height = 0;
		}
		heightlabel.text = height + "m";
		heighttick.scrollmove(height);
	}

	public void height_warning()
	{
		if (!iswarning)
		{
			heightsp.spriteName = "CZ_A_BiaoShi_2";
			heightlabel.color = Color.red;
			heightanima.PlayForward();
			iswarning = true;
			MonoInstance<AudioController>.instance.play(AudioType.warning, 0f);
		}
	}

	public void height_normal()
	{
		if (iswarning)
		{
			heightsp.spriteName = "CZ_A_BiaoShi_1";
			heightlabel.color = Color.white;
			heightanima.enabled = false;
			heightsp.alpha = 1f; heightsp.gameObject.SetActive(true);
			iswarning = false;
			MonoInstance<AudioController>.instance.stop(AudioType.warning);
		}
	}

	public void ai_dirshow(Vector3 dirpos, int num, bool istrue, float scalerate = 0.6f, AI_TYPE typeai = AI_TYPE.aiplane)
	{
		NGUITools.SetActive(dirflags[num].gameObject, istrue);
		if (dirpos != Vector3.zero)
		{
			if (typeai == AI_TYPE.aiplane)
			{
				if (dirflags[num].spriteName != "DT_A_jiantou_01")
				{
					dirflags[num].spriteName = "DT_A_jiantou_01";
				}
			}
			else if (dirflags[num].spriteName != "DT_A_jiantou_02")
			{
				dirflags[num].spriteName = "DT_A_jiantou_02";
			}
			dirflags[num].transform.localPosition = new Vector3((dirpos.x - (float)(Screen.width / 2)) / GlobalInf.ratioReltoUI, (dirpos.y - (float)(Screen.height / 2)) / GlobalInf.ratioReltoUI, 0f);
			dirflags[num].transform.up = dirflags[num].transform.localPosition;
			dirflags[num].transform.localScale = new Vector3(scalerate, scalerate, scalerate);
		}
		else
		{
			dirflags[num].transform.localPosition = disappearPos;
		}
	}

	public void ai_frameshow(Vector3 framepos, int num, bool istrue, AI_TYPE typeai = AI_TYPE.aiplane)
	{
		NGUITools.SetActive(frameflags[num].gameObject, istrue);
		if (framepos != Vector3.zero)
		{
			if (typeai == AI_TYPE.aiboss)
			{
				if (frameflags[num].spriteName != "DT_A_suoDing_Boss")
				{
					frameflags[num].spriteName = "DT_A_suoDing_Boss";
				}
			}
			else if (frameflags[num].spriteName != "DT_A_suoDing_01")
			{
				frameflags[num].spriteName = "DT_A_suoDing_01";
			}
			frameflags[num].transform.localPosition = new Vector3((framepos.x - (float)(Screen.width / 2)) / GlobalInf.ratioReltoUI, (framepos.y - (float)(Screen.height / 2)) / GlobalInf.ratioReltoUI, 0f);
		}
		else
		{
			frameflags[num].transform.localPosition = disappearPos;
		}
	}

	public void missileframe_yellow(Vector3 framepos, int num, bool istrue)
	{
		if (!istrue)
		{
			NGUITools.SetActive(frameflag_yellow.gameObject, state: false);
			frameflag_yellow.transform.localPosition = disappearPos;
			plane_smothfollow.instance.missileCurAi = null;
			playanima_yes = false;
			if (missile_yellow_flag.enabled)
			{
				missile_yellow_flag.enabled = false;
			}
		}
		else if (ishavesingle && Vector3.Distance(frameflags[num].transform.localPosition, playerAimFlag.transform.localPosition) < 150f * GlobalInf.ratioReltoUI)
		{
			frameflag_yellow.transform.localPosition = new Vector3((framepos.x - (float)(Screen.width / 2)) / GlobalInf.ratioReltoUI, (framepos.y - (float)(Screen.height / 2)) / GlobalInf.ratioReltoUI, 0f);
			if (frameflags[num].enabled)
			{
				frameflags[num].enabled = false;
			}
			NGUITools.SetActive(frameflag_yellow.gameObject, state: true);
			if (!playanima_yes)
			{
				yellow_frameAnima.Play(forward: true);
				playanima_yes = true;
			}
			if (weaponUIcon.cur_singlemissile > 0)
			{
				if (frameflag_yellow.color != yellowcolor)
				{
					frameflag_yellow.color = yellowcolor;
				}
				if (!missile_yellow_flag.enabled)
				{
					missile_yellow_flag.enabled = true;
				}
				plane_smothfollow.instance.missileCurAi = AIPool.instance.curaimAI;
			}
			else
			{
				if (frameflag_yellow.color != Color.white)
				{
					frameflag_yellow.color = Color.white;
				}
				if (missile_yellow_flag.enabled)
				{
					missile_yellow_flag.enabled = false;
				}
				plane_smothfollow.instance.missileCurAi = null;
			}
		}
		else
		{
			NGUITools.SetActive(frameflag_yellow.gameObject, state: false);
			if (missile_yellow_flag.enabled)
			{
				missile_yellow_flag.enabled = false;
			}
			if (!frameflags[num].enabled && !frameflags_red[num].enabled)
			{
				frameflags[num].enabled = false;
			}
			frameflag_yellow.transform.localPosition = disappearPos;
			plane_smothfollow.instance.missileCurAi = null;
			playanima_yes = false;
		}
	}

	public bool missilelockai_red(int num, bool istrue)
	{
		if (istrue)
		{
			if (ishavemultiple && UnityVersionUtil.IsActive(frameflags[num].gameObject) && Vector3.Distance(frameflags[num].transform.localPosition, playerAimFlag.transform.localPosition) < 150f * GlobalInf.ratioReltoUI)
			{
				if (!frameflags_red[num].enabled)
				{
					frameflags_red[num].enabled = true;
					frameflagsAnima[num].Play(forward: true);
				}
				if (weaponUIcon.cur_missile > plane_smothfollow.instance.curAIList.Count)
				{
					if (frameflags_red[num].color != Color.red)
					{
						frameflags_red[num].color = Color.red;
					}
				}
				else if (frameflags_red[num].color != Color.white)
				{
					frameflags_red[num].color = Color.white;
				}
				if (frameflags[num].enabled)
				{
					frameflags[num].enabled = false;
				}
				return true;
			}
			if (frameflags_red[num].enabled)
			{
				frameflags_red[num].enabled = false;
			}
			if (!frameflags[num].enabled && !UnityVersionUtil.IsActive(frameflag_yellow.gameObject))
			{
				frameflags[num].enabled = true;
			}
			return false;
		}
		if (frameflags_red[num].enabled)
		{
			frameflags_red[num].enabled = false;
		}
		if (!frameflags[num].enabled && !UnityVersionUtil.IsActive(frameflag_yellow.gameObject))
		{
			frameflags[num].enabled = true;
		}
		return false;
	}

	public void setred_flag_showbtn(bool state)
	{
		if (missile_red_flag.enabled != state)
		{
			missile_red_flag.enabled = state;
		}
	}

	public void showbulletnum(int guntype)
	{
		weaponUIcon.showweaponnum(guntype, -1);
	}

	public void show_hitinfo(string str)
	{
		hitinfo_label.text = str;
	}

	public void show_hitinfo_down(string str)
	{
		hitinfo_label_down.text = str;
	}

	public void hitinfo_appear()
	{
		hitinfo_anim.PlayForward();
	}

	public void hitinfo_disappear()
	{
		Invoke("hitdis", 1f);
	}

	public void hitdis()
	{
		hitinfo_anim.PlayReverse();
	}

	public void missilelock_appear()
	{
		missilelockwi.alpha = 1f; missilelockwi.gameObject.SetActive(true);
	}

	public void missilelock_disappear()
	{
		missilelockwi.alpha = 0f; missilelockwi.gameObject.SetActive(false);
	}

	public void show_time(float time)
	{
		if (time > 0f)
		{
			if (!UnityVersionUtil.IsActive(timeobj))
			{
				NGUITools.SetActive(timeobj, state: true);
			}
			timelabel.text = MyMath.TimeSet(time);
		}
		else
		{
			NGUITools.SetActive(timeobj, state: false);
		}
	}

	public void show_holes()
	{
		if (holesnum < holes.Count)
		{
			if (width_screen == 0)
			{
				width_screen = (int)GlobalInf.screenRatioWidth;
			}
			holes[holesnum].transform.localPosition = new Vector3((float)UnityEngine.Random.Range(-4, 5) * 80f, (float)UnityEngine.Random.Range(-3, 4) * 90f, 0f);
			scalerate = (float)UnityEngine.Random.Range(5, 11) / 10f;
			holes[holesnum].transform.localScale = new Vector3(scalerate, scalerate, scalerate);
			holes[holesnum].transform.localRotation = Quaternion.Euler(new Vector3(0f, 0f, (float)UnityEngine.Random.Range(0, 11) * 36f));
			holes[holesnum].showhole();
			holesnum++;
		}
	}

	private void OnDestroy()
	{
		if (instance != null)
		{
			instance = null;
		}
	}

	private void OnApplicationFocus(bool isfocus)
	{
		if (isfocus)
		{
		}
	}
}
